local FightInterface = require("gameLogic.fightSkill.sequence.FightInterface")
local FightParallel = class("FightParallel", FightInterface)

function FightParallel:ctor()
    FightParallel.super.ctor(self)
    self._children = {}
end

function FightParallel:addChild(child)
    table.insert(self._children, child)
end

function FightParallel:_update()
    local doneCount = 0
    for i = 1, #self._children do
        if not self._children[i]:isDone() then
            self._children[i]:tick()
        end
        if self._children[i]:isDone() then
            doneCount = doneCount + 1
        end
    end
    if doneCount == #self._children then
        self._isDone = true
    end
end

return FightParallel
